﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace SimplexEngine
{
    public class MRTLightingMaterial : Material
    {
        public MRTLightingMaterial()
        {
            effect = Root.Instance.ContentSystem.GetResource("MRTLighting.Shader");
            diffuse_texture.Create("MRT:ColorTexture", true);
            //diffuse_texture.Create("MRT:NormalTexture", true);
            lighting_texture.Create("Lighting:Lighting", true);
        }

        protected override void OnApplyParameters(GameTime game_time, Int64 frame_number)
        {            
            Effect.Parameters["DiffuseTexture"].SetValue(DiffuseTexture.Texture);
            Effect.Parameters["LightingTexture"].SetValue(LightingTexture.Texture);
        }

        public MaterialTexture DiffuseTexture { get { return diffuse_texture; } }
        protected MaterialTexture diffuse_texture = new MaterialTexture();

        public MaterialTexture LightingTexture { get { return lighting_texture; } }
        protected MaterialTexture lighting_texture = new MaterialTexture();

        public override Material Clone()
        {
            MRTLightingMaterial material = new MRTLightingMaterial();
            material.diffuse_texture = diffuse_texture;
            material.lighting_texture = lighting_texture;
            return material;
        }
    }
}
